package com.youyi.yyviewsdklibrary.Dialog.animator;

import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.view.View;
import android.view.animation.OvershootInterpolator;
import com.youyi.yyviewsdklibrary.Dialog.enums.PopupAnimation;

public class ScaleAlphaAnimator extends PopupAnimator {
    float startScale = 0.95f;

    public ScaleAlphaAnimator(View view, int i, PopupAnimation popupAnimation) {
        super(view, i, popupAnimation);
    }

    @Override // com.youyi.yyviewsdklibrary.Dialog.animator.PopupAnimator
    public void initAnimator() {
        this.targetView.setScaleX(this.startScale);
        this.targetView.setScaleY(this.startScale);
        this.targetView.setAlpha(0.0f);
        this.targetView.post(new Runnable() {
            /* class com.youyi.yyviewsdklibrary.Dialog.animator.ScaleAlphaAnimator.AnonymousClass1 */

            public void run() {
                ScaleAlphaAnimator.this.applyPivot();
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void applyPivot() {
        int i = this.popupAnimation.ordinal();
        if (i == 1) {
            this.targetView.setPivotX(((float) this.targetView.getMeasuredWidth()) / 2.0f);
            this.targetView.setPivotY(((float) this.targetView.getMeasuredHeight()) / 2.0f);
        } else if (i == 2) {
            this.targetView.setPivotX(0.0f);
            this.targetView.setPivotY(0.0f);
        } else if (i == 3) {
            this.targetView.setPivotX((float) this.targetView.getMeasuredWidth());
            this.targetView.setPivotY(0.0f);
        } else if (i == 4) {
            this.targetView.setPivotX(0.0f);
            this.targetView.setPivotY((float) this.targetView.getMeasuredHeight());
        } else if (i == 5) {
            this.targetView.setPivotX((float) this.targetView.getMeasuredWidth());
            this.targetView.setPivotY((float) this.targetView.getMeasuredHeight());
        }
    }

    @Override // com.youyi.yyviewsdklibrary.Dialog.animator.PopupAnimator
    public void animateShow() {
        this.targetView.post(new Runnable() {
            /* class com.youyi.yyviewsdklibrary.Dialog.animator.ScaleAlphaAnimator.AnonymousClass2 */

            public void run() {
                ScaleAlphaAnimator.this.targetView.animate().scaleX(1.0f).scaleY(1.0f).alpha(1.0f).setDuration((long) ScaleAlphaAnimator.this.animationDuration).setInterpolator(new OvershootInterpolator(1.0f)).start();
            }
        });
    }

    @Override // com.youyi.yyviewsdklibrary.Dialog.animator.PopupAnimator
    public void animateDismiss() {
        if (!this.animating) {
            observerAnimator(this.targetView.animate().scaleX(this.startScale).scaleY(this.startScale).alpha(0.0f).setDuration((long) this.animationDuration).setInterpolator(new FastOutSlowInInterpolator())).start();
        }
    }
}
